<template>
  <div>
    <!--生产异常-餐台餐椅-->
    <jc-table
      serial
      :table-data="tableData"
      :table-header="tableHeader"
    >
      <!--订单编码-->
      <template v-slot:tagSlot="col">
        <el-link type="primary" @click="detailPurchase(col.scope.row)">{{ col.scope.row.fbillno }}</el-link>
      </template>
    </jc-table>
  </div>
</template>

<script>
import { queryInStockAbnormal } from '@/api/homePage/business'

export default {
  props: {
    department: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      tableData: [],
      tableHeader: [
        { label: this.$t('market.paezText1'), prop: 'sal_khddh' },
        { label: this.$t('market.scdh'), type: 'tag', prop: 'fbillno' },
        { label: this.$t('market.orderDate1'), prop: 'fdate' },
        { label: this.$t('market.prodept'), prop: 'departmentname' },
        { label: this.$t('market.fmaterial'), prop: 'fnumber' },
        { label: this.$t('shop.fname2'), prop: 'fname' },
        { label: this.$t('shop.fspecificaTion'), prop: 'fspecification', width: '200' },
        { label: this.$t('market.productNum'), prop: 'fqty' },
        { label: this.$t('market.pushqty'), prop: 'fcompleteqty' }
      ]
    }
  },
  created() {
    this.queryInStock()
  },
  methods: {
    queryInStock() {
      queryInStockAbnormal({ departmentname: this.department }).then(res => {
        if (res.code === 0) {
          this.tableData = res.data
        } else {
          this.$confirm(res.message, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'error'
          })
        }
      })
    },
    // 详情
    detailPurchase(ev) {
      const id = ev.fbillno
      this.$router.push({ path: `/proOrderDetails/${id}` })
    }
  }
}
</script>
<style lang="scss" scoped>

</style>
